#!/bin/bash
echo "=== 检查系统依赖 ==="

REQUIRED_PACKAGES=(
    "cmake"
    "gcc"
    "g++"
    "make"
    "sqlite3"
    "git"
    "python3"
    "curl"
)

MISSING_PACKAGES=()

for package in "${REQUIRED_PACKAGES[@]}"; do
    if ! command -v "$package" &> /dev/null; then
        MISSING_PACKAGES+=("$package")
    fi
done

if [ ${#MISSING_PACKAGES[@]} -eq 0 ]; then
    echo "✅ 所有依赖已安装"
else
    echo "❌ 缺少以下依赖:"
    for package in "${MISSING_PACKAGES[@]}"; do
        echo "   - $package"
    done
    echo ""
    echo "💡 安装命令: pacman -S ${MISSING_PACKAGES[*]}"
fi
